const mysql = require('mysql');
// console.log(mysql);

var { createConnection } = mysql;

var conn = createConnection({
    host: "localhost",
    user: "root",
    password: "root",
    database: "2111",
})
// console.log(conn);

conn.connect();

// 执行sql语句
// conn.query("select * from `grade`", function (err, list) {
//     if (err) throw err;
//     // console.log(list);
//     console.log(field);
// })
conn.query("insert into `grade`(name,class,chinese,math,english)  values('小六子','2111',77,88,99)", function (err, info) {
    if (err) {
        console.log(err.sqlMessage);
        console.log(err.sql);
    } else {
        console.log(info.affectedRows);
    }
})






conn.end();


